package threads;
import java.util.*;
import java.lang.*;

public class Runner{
  
  public static void main(String args[]) throws Exception {
    
    // Data for the excersise
    ArrayList ar = new ArrayList();
    HashMap map = new HashMap();
    map.put("name", "Informant1");
    map.put("description", "Informant 1");
    map.put("wait", Integer.toString(3000));
    ar.add(map);
    
    map = new HashMap();
    map.put("name", "Informant2");
    map.put("description", "Informant 2");
    map.put("wait", Integer.toString(6000));
    ar.add(map);
    
    map = new HashMap();
    map.put("name", "Informant3");
    map.put("description", "Informant 3");
    map.put("wait", Integer.toString(1000));
    ar.add(map);
    
    for (int i=0;i<ar.size();i++){
      HashMap h = (HashMap) ar.get(i);
      Informant bob = (Informant)(Class.forName( h.get("name").toString() ).newInstance()); 
      bob.name = h.get("name").toString();
      bob.waitTime =Integer.parseInt( h.get("wait").toString());
      Thread t = new Thread( bob);
      t.start();
      /*
      InformantInterface informant = (InformantInterface)(Class.forName( h.get("name").toString() ).newInstance()); 
      informant.process(h.get("description").toString(), Integer.parseInt( h.get("wait").toString()));
      */
    }
    
  }
}